package com.example.blades.mylogdemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class LogActivity extends AppCompatActivity {
    private static final String ACTIVITY_TAG="LogActivity";

    private Button bt;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_log);


        //通过findViewById找到Button资源
        bt=(Button)findViewById(R.id.btn);

        bt.setOnClickListener(new Button.OnClickListener()
        {
            //增加事件响应
            public void onClick(View v)
            {
                Log.v(LogActivity.ACTIVITY_TAG,"This is Verbose.");
                Log.d(LogActivity.ACTIVITY_TAG,"This is Debug.");
                Log.i(LogActivity.ACTIVITY_TAG,"This is Information.");
                Log.w(LogActivity.ACTIVITY_TAG,"This is Warning.");
                Log.e(LogActivity.ACTIVITY_TAG,"This is Error.");
            }});

    }
}
